import type { aiHistroy, aiHistoryPageInfo, aiMessage,uid} from "@/types/ai"
import { sendRequest } from "@/utils/http"
export const getHistoryAPI = (uTime: string, lastQuestion: string) => {
  let data = { uTime: uTime ,lastQuestion: lastQuestion}
  return sendRequest<aiHistroy[]>({
    url: "/server-ai/ai/history",
    method: "GET",//put请求也是这样
    data: data
  })
}
//GET/server-ai/ai/getAiHistoryPageInfo
export const getHistoryPageInfoAPI = (userId: number, pageNum: number, pageSize: number) => {
 let data = { userId: userId, pageNum: pageNum, pageSize: pageSize }
  return sendRequest<aiHistroy[]>({
    url: "/server-ai/ai/getAiHistoryPageInfo",
    method: "GET",//put请求也是这样
    data: data
  }) 
}

//POST/server-ai/ai/addAiHistory
export const addAiHistoryAPI = (historyData:aiHistroy) => {
  return sendRequest<string>({
    url: "/server-ai/ai/addAiHistory",
    method: "POST",//put请求也是这样
    data: historyData
  })
}

//POST/server-ai/ai/sendAiMessage
export const sendAiMessageAPI = (uid:string,userId:DOMStringList,isAi:boolean,content:string,sendTime:Date) => {
  let data = { uid: uid,userId: userId,isAi: isAi,content: content,sendTime: sendTime }
  return sendRequest<string>({
    url: "/server-ai/ai/sendAiMessage",
    method: "POST",//put请求也是这样
    data: data
  })
}

//GET/server-ai/ai/getAiMessageList
export const getAiMessageListAPI = (uid:string) => {
   let data= { uid: uid ,pageNum: 1, pageSize: 10}
  return sendRequest<aiMessage[]>({
    url: "/server-ai/ai/getAiMessageList",
    method: "GET",//put请求也是这样
    data: data
  })
}

export const sendMessageAPI=(aiMessageInfo:aiMessage)=>{
  return sendRequest<aiMessage>({
    url: "/server-ai/ai/sendMessage",
    method: "POST",//put请求也是这样
    data: aiMessageInfo
  })
}